package com.example.xcspringboot_one.service;

import com.example.xcspringboot_one.pojo.Book;
import com.example.xcspringboot_one.service.impl.BookServiceImpl;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @author xiaoChen
 * @description: AUTO GENERATION
 * @date 2022/4/24 12:16
 */
@SpringBootTest
public class Demo {

    @Autowired
    private BookServiceImpl bookService;

    @Test
    public void testSave() {
        Book book = new Book();
        book.setId(null);
        book.setName("算法导论");
        book.setAuthor("鲁迅");
        book.setPublish("工业出版社");
        book.setPages("180");
        book.setPrice("46");
        bookService.save(book);
    }


    @Test
    public void testDelete() {
        bookService.deleteById(119);
    }

    @Test
    public void testUpdate(){
        Book book = new Book();
        book.setId(1);
        book.setName("算法导论");
        book.setAuthor("鲁迅");
        book.setPublish("工业出版社");
        book.setPages("180");
        book.setPrice("46");
        bookService.update(book);
    }



    @Test
    public void testFindById(){
        System.out.println(bookService.findById(1));
    }



}
